package com.betterjr.modules.risk.loanmanage.entity;

import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.betterjr.common.annotation.MetaData;
import com.betterjr.common.entity.BetterjrEntity;

@Access(AccessType.FIELD)
@Entity
@Table(name = "t_repayment_details")
public class RepaymentDetails implements BetterjrEntity {
    public static final String selectKey = "RepaymentDetails.id";
    /**
     * ID
     */
    @Id
    @Column(name = "ID", columnDefinition = "INTEGER")
    @MetaData(value = "ID", comments = "ID")
    private Long id;

    /**
     * 放款数据ID
     */
    @Column(name = "P_LOAN_DATA_ID", columnDefinition = "INTEGER")
    @MetaData(value = "放款数据ID", comments = "放款数据ID")
    private Long loanDataId;

    /**
     * 金额
     */
    @Column(name = "N_AMOUNT", columnDefinition = "DECIMAL")
    @MetaData(value = "金额", comments = "金额")
    private BigDecimal amount;

    /**
     * 还款日期
     */
    @Column(name = "D_REPAYMENT_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "还款日期", comments = "还款日期")
    private Timestamp repaymentdate;

    /**
     * 还款类型，还息：0，还本：1
     */
    @Column(name = "C_REPAYMENT_TYPE", columnDefinition = "CHAR")
    @MetaData(value = "还款类型", comments = "还款类型，还息：0，还本：1")
    private String repaymentType;

    /**
     * 还款方式   废弃 目前无用，（现金，税票）
     */
    @Column(name = "C_REPAYMENT_MODE", columnDefinition = "CHAR")
    @MetaData(value = "还款方式", comments = "还款方式")
    private String repaymentMode;

    /**
     * 状态 012..
     */
    @Column(name = "C_STATUS", columnDefinition = "CHAR")
    @MetaData(value = "状态 012..", comments = "状态 012..")
    private String status;

    /**
     * 息金提前结清标志
     */
    @Column(name = "C_SETTLEMENT_FLAG", columnDefinition = "CHAR")
    @MetaData(value = "息金提前结清标志", comments = "息金提前结清标志")
    private String settlementFlag;

    /**
     * 创建时间
     */
    @Column(name = "D_CREATE_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "创建时间", comments = "创建时间")
    private Timestamp createDate;

    /**
     * 创建人
     */
    @Column(name = "C_CREATOR", columnDefinition = "VARCHAR")
    @MetaData(value = "创建人", comments = "创建人")
    private String creator;

    /**
     * 创建人ID
     */
    @Column(name = "N_CREATOR_ID", columnDefinition = "INTEGER")
    @MetaData(value = "创建人ID", comments = "创建人ID")
    private Long creatorId;

    /**
     * 最后更新时间
     */
    @Column(name = "D_UPDATE_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "最后更新时间", comments = "最后更新时间")
    private Timestamp updateDate;

    /**
     * 最后更新人
     */
    @Column(name = "C_UPDATE_CREATOR", columnDefinition = "VARCHAR")
    @MetaData(value = "最后更新人", comments = "最后更新人")
    private String updateCreator;

    /**
     * 最后更新人ID
     */
    @Column(name = "N_UPDATE_CREATOR_ID", columnDefinition = "INTEGER")
    @MetaData(value = "最后更新人ID", comments = "最后更新人ID")
    private Long updateCreatorId;

    private static final long serialVersionUID = 1530085037591L;

    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public Long getLoanDataId() {
        return loanDataId;
    }

    public void setLoanDataId(final Long loanDataId) {
        this.loanDataId = loanDataId;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(final BigDecimal amount) {
        this.amount = amount;
    }

    public Timestamp getRepaymentdate() {
        return repaymentdate;
    }

    public void setRepaymentdate(final Timestamp repaymentdate) {
        this.repaymentdate = repaymentdate;
    }

    public String getRepaymentType() {
        return repaymentType;
    }

    public void setRepaymentType(final String repaymentType) {
        this.repaymentType = repaymentType;
    }

    public String getRepaymentMode() {
        return repaymentMode;
    }

    public void setRepaymentMode(final String repaymentMode) {
        this.repaymentMode = repaymentMode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(final String status) {
        this.status = status;
    }

    public String getSettlementFlag() {
        return settlementFlag;
    }

    public void setSettlementFlag(final String settlementFlag) {
        this.settlementFlag = settlementFlag;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(final Timestamp createDate) {
        this.createDate = createDate;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(final String creator) {
        this.creator = creator;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(final Long creatorId) {
        this.creatorId = creatorId;
    }

    public Timestamp getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(final Timestamp updateDate) {
        this.updateDate = updateDate;
    }

    public String getUpdateCreator() {
        return updateCreator;
    }

    public void setUpdateCreator(final String updateCreator) {
        this.updateCreator = updateCreator;
    }

    public Long getUpdateCreatorId() {
        return updateCreatorId;
    }

    public void setUpdateCreatorId(final Long updateCreatorId) {
        this.updateCreatorId = updateCreatorId;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", loanDataId=").append(loanDataId);
        sb.append(", amount=").append(amount);
        sb.append(", repaymentdate=").append(repaymentdate);
        sb.append(", repaymentType=").append(repaymentType);
        sb.append(", repaymentMode=").append(repaymentMode);
        sb.append(", status=").append(status);
        sb.append(", settlementFlag=").append(settlementFlag);
        sb.append(", createDate=").append(createDate);
        sb.append(", creator=").append(creator);
        sb.append(", creatorId=").append(creatorId);
        sb.append(", updateDate=").append(updateDate);
        sb.append(", updateCreator=").append(updateCreator);
        sb.append(", updateCreatorId=").append(updateCreatorId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(final Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        final RepaymentDetails other = (RepaymentDetails) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getLoanDataId() == null ? other.getLoanDataId() == null
                        : this.getLoanDataId().equals(other.getLoanDataId()))
                && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
                && (this.getRepaymentdate() == null ? other.getRepaymentdate() == null
                        : this.getRepaymentdate().equals(other.getRepaymentdate()))
                && (this.getRepaymentType() == null ? other.getRepaymentType() == null
                        : this.getRepaymentType().equals(other.getRepaymentType()))
                && (this.getRepaymentMode() == null ? other.getRepaymentMode() == null
                        : this.getRepaymentMode().equals(other.getRepaymentMode()))
                && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
                && (this.getSettlementFlag() == null ? other.getSettlementFlag() == null
                        : this.getSettlementFlag().equals(other.getSettlementFlag()))
                && (this.getCreateDate() == null ? other.getCreateDate() == null
                        : this.getCreateDate().equals(other.getCreateDate()))
                && (this.getCreator() == null ? other.getCreator() == null
                        : this.getCreator().equals(other.getCreator()))
                && (this.getCreatorId() == null ? other.getCreatorId() == null
                        : this.getCreatorId().equals(other.getCreatorId()))
                && (this.getUpdateDate() == null ? other.getUpdateDate() == null
                        : this.getUpdateDate().equals(other.getUpdateDate()))
                && (this.getUpdateCreator() == null ? other.getUpdateCreator() == null
                        : this.getUpdateCreator().equals(other.getUpdateCreator()))
                && (this.getUpdateCreatorId() == null ? other.getUpdateCreatorId() == null
                        : this.getUpdateCreatorId().equals(other.getUpdateCreatorId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getLoanDataId() == null) ? 0 : getLoanDataId().hashCode());
        result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
        result = prime * result + ((getRepaymentdate() == null) ? 0 : getRepaymentdate().hashCode());
        result = prime * result + ((getRepaymentType() == null) ? 0 : getRepaymentType().hashCode());
        result = prime * result + ((getRepaymentMode() == null) ? 0 : getRepaymentMode().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getSettlementFlag() == null) ? 0 : getSettlementFlag().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
        result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
        result = prime * result + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode());
        result = prime * result + ((getUpdateCreator() == null) ? 0 : getUpdateCreator().hashCode());
        result = prime * result + ((getUpdateCreatorId() == null) ? 0 : getUpdateCreatorId().hashCode());
        return result;
    }
}